Skip to content

fix(cli): guard against @objectstack/console objectui-SHA drift#2507

Merged
os-zhuang merged 1 commit into
mainfrom
fix/console-sha-drift-guard
Jul 1, 2026
Merged

fix(cli): guard against @objectstack/console objectui-SHA drift#2507
os-zhuang merged 1 commit into
mainfrom
fix/console-sha-drift-guard

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Problem

Pull a branch that bumps the objectui pin (.objectui-sha) but forget to re-run pnpm objectui:refresh, and pnpm build does not regenerate the Console — a Console built from a different objectui commit gets served silently.

Root cause: packages/console/dist is gitignored and produced only by scripts/build-console.sh; turbo run build never rebuilds it, and the existing CLI resolver guard compares only the npm major of @objectstack/console (blind to the objectui SHA underneath).

Scope: local dev only — the release pipeline always rebuilds the Console from the pin, so published artifacts are never affected.

Fix — fail-loud drift guard

  • Provenance stamp: build-console.sh writes the built SHA into dist/.objectui-sha (travels with dist/; a cloud Docker overlay that replaces dist/ restamps it).
  • pnpm check:console-sha: compares stamp vs the committed pin. Hard-gates pnpm dev / dev:crm / dev:todo; no-ops when the Console isn't built yet.
  • Serve-time warn: resolveConsolePath warns when it selects a drifted dist — covers every boot path (os serve, self-host), not just pnpm dev. No-op for published installs (no pin up-tree, so the stamped dist stays authoritative).
  • CI self-test: showcase-smoke runs check:console-sha right after build-console.sh so the stamping mechanism can't silently rot.

Remediation the guard prints is pnpm objectui:build (rebuild at the pinned SHA) — not objectui:refresh, which would re-bump the pin to your local ../objectui HEAD.

Verification

  • Three states exercised manually: in-sync ✓ (exit 0), drift ✗ (exit 1), unstamped dist → non-fatal warn.
  • @objectstack/cli tsc clean; console-resolve.test.ts 11 passed (7 existing + 4 new guard cases: drift / in-sync / unstamped / published-install).

🤖 Generated with Claude Code

packages/console/dist is a gitignored, locally-built artifact that only
scripts/build-console.sh produces — `turbo run build` never rebuilds it.
So pulling a branch that bumps the committed .objectui-sha pin left a stale
dist in place, and the CLI silently served a Console built from a different
objectui commit (the npm-major version guard can't see a SHA move under a
single @objectstack/console version).

- build-console.sh stamps the built SHA into dist/.objectui-sha
- new scripts/check-console-sha.mjs compares stamp vs pin; hard-gates
  pnpm dev / dev:crm / dev:todo, and is self-tested in showcase-smoke CI
- resolveConsolePath warns at serve time on a drifted dist (all boot paths)
- remediation is `pnpm objectui:build`; published installs ship no pin so
  the guard is a no-op there

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jul 1, 2026 4:04pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci/cd dependencies Pull requests that update a dependency file tests tooling size/m labels Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cli.

15 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/cloud-artifact-api.mdx (via packages/cli)
  • content/docs/concepts/implementation-status.mdx (via @objectstack/cli)
  • content/docs/concepts/packages.mdx (via @objectstack/cli)
  • content/docs/getting-started/cli.mdx (via @objectstack/cli)
  • content/docs/getting-started/quick-start.mdx (via @objectstack/cli)
  • content/docs/guides/authentication.mdx (via @objectstack/cli)
  • content/docs/guides/client-sdk.mdx (via @objectstack/cli)
  • content/docs/guides/hook-bodies.mdx (via packages/cli)
  • content/docs/guides/packages.mdx (via @objectstack/cli)
  • content/docs/guides/project-scoping.mdx (via @objectstack/cli)
  • content/docs/guides/runtime-services/data-service.mdx (via packages/cli)
  • content/docs/guides/runtime-services/index.mdx (via packages/cli)
  • content/docs/guides/skills.mdx (via packages/cli)
  • content/docs/protocol/objectos/plugin-spec.mdx (via @objectstack/cli)
  • content/docs/protocol/objectos/realtime-protocol.mdx (via @objectstack/cli)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit c77a8f5 into main Jul 1, 2026
17 checks passed
@os-zhuang
os-zhuang deleted the fix/console-sha-drift-guard branch July 1, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant